package com.jquest.data;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Vector2f;
import com.jquest.collision.CollisionMask;

/**
 * A template class for entities
 * User: Johan
 * Date: 2009-dec-11
 * Time: 03:26:44
 */
public abstract class AbstractEntity implements Renderable {
    private float x, y;
    private CollisionMask mask;

    public AbstractEntity(float x, float y) {
        this.x = x;
        this.y = y;
    }

    public CollisionMask getCollisionMask() {
        return mask;
    }

    public void setCollisionMask(CollisionMask mask) {
        this.mask = mask;
    }

    public float getX() {
        return x;
    }

    public float getY() {
        return y;
    }


    public float getCenterX() {
        return getX() + (16 / 2);
    }

    public float getCenterY() {
        return getY() + (24 / 2);
    }

    public void setX(float x) {
        this.x = x;
    }

    public void setY(float y) {
        this.y = y;
    }

    public void setPosition(float x, float y) {
        this.x = x;
        this.y = y;
    }

    public void setPosition(Vector2f position) {
        this.x = position.getX();
        this.y = position.getY();
    }

    public abstract void render(Graphics g, Object attachment);
    public abstract void update(int time);

}
